#pragma  once
#include "base/core/singleton.h"
#include <stdint.h>
#include <unordered_map>
#include <string>
#include <vector>
#include "base/core/point3.h"
#include "base/core/char_operation.h"
#include "Common/AchievementDefine.h"
#include "Common/MessageDispatch/IMessageDispatch.h"
#include "Character/Player.h"
#include "Character/PlayerMgr.h"

using namespace std;

class AchievementMgr : public IServerMessageHandler, public ManualSingleton < AchievementMgr >
{
	friend class ManualSingleton < AchievementMgr >;
	
public:

	AchievementMgr();
	virtual ~AchievementMgr();

	bool				Init();
	bool				UnInit();

	//////////////////////////////  IServerMessageHandler ////////////////////////////////////////////
	virtual void		onServerMessage(uint32_t actionId, RECV_PACKAGE &package);
	virtual const char* getServerHandlerDebugInfo(void){ return "AchievementMgr::onServerMessage"; }

	bool				LoadAchievementCfg();
	bool				LoadAchievementRewardCfg();

public:
	//根据事件大类型以及事件子类型获取成就ID集合
	VEC_UINT32* GetAchievementIdVec(AchievementParameterInfo& achievementParameter);
	int32_t GetAchievementBoxIndex(uint32_t sortType, uint32_t pointValue);
	uint32_t GetAchieveOpenLel() { return _openLevel; }

public:
	//处理中心服协议(废弃)
	bool	OnWGAchievementNotify(RECV_PACKAGE &package);
	
private:
	OEDER_MAP_UINT32_ORDER_MAP_UINT32_VEC_UINT32  _typeAchievementIdMap;
	OEDER_MAP_UINT32_ORDER_MAP_UINT32_UINT32  _typeAchievementRewardIndexMap;
	uint32_t _openLevel;
};

#define g_MakeAchievementMgr() (AchievementMgr::Instance())
#define g_GetAchievementMgr()  (AchievementMgr::GetInstance())
#define g_DelAchievementMgr()  (AchievementMgr::Destroy())